<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div>333</div>
</body>
<script>
    var div = document.querySelector("div")
    div.onclick = function () {
        localStorage.setItem('detailId', '4')
        window.location.href = 'Details.html'
    }
</script>

</html>